﻿/*
 * CollectionHelper
 * 
 * Author: snowdreamist
 * Date: 2011/11/19
 * 
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BitTorrentSharp.Helpers
{
    public static class CollectionHelper
    {
        public static T[] ExpandOneTime<T>(T[] sourceArray)
        {
            T[] newArray = new T[sourceArray.Length * 2];

            sourceArray.CopyTo(newArray, 0);

            return newArray;
        }

        public static Dictionary<TKey, TValue> CloneDictionary<TKey, TValue>(this Dictionary<TKey, TValue> dict)
        {
            if (dict == null)
                throw new ArgumentNullException("dict");

            return new Dictionary<TKey, TValue>(dict);
        }
    }
}
